#include <catch2/catch.hpp>

#include "solution.hpp"

using namespace solution_044;

TEST_CASE("44. Wildcard Matching", "[044]") {

CHECK(Solution().isMatch("aa", "a")        == false);
CHECK(Solution().isMatch("aa", "*")        == true);
CHECK(Solution().isMatch("cb", "?a")       == false);
CHECK(Solution().isMatch("adceb", "*a*b")  == true);
CHECK(Solution().isMatch("acdcb", "a*c?b") == false);
CHECK(Solution().isMatch("", "")           == true);
CHECK(Solution().isMatch("", "*")          == true);
CHECK(Solution().isMatch("aa", "")         == false);
CHECK(Solution().isMatch("aaaa", "***a")   == true);
CHECK(Solution().isMatch("aaaba", "***a")  == true);
CHECK(Solution().isMatch("aaabab", "*b*b") == true);
CHECK(Solution().isMatch("ab", "*?*?*") == true);

CHECK(Solution().isMatch("mississippi", "m??*ss*?i*pi") == false);
CHECK(Solution().isMatch("", "****") == true);
CHECK(Solution().isMatch("a", "****a") == true);
CHECK(Solution().isMatch("a", "a****") == true);
CHECK(Solution().isMatch("ab", "a****b") == true);
CHECK(Solution().isMatch(
            "abbabaaabbabbaababbabbbbbabbbabbbabaaaaababababbbabababaabbababaabbbbbbaaaabababbbaabbbbaabbbbababababbaabbaababaabbbababababbbbaaabbbbbabaaaabbababbbbaababaabbababbbbbababbbabaaaaaaaabbbbbaabaaababaaaabb",
            "**aa*****ba*a*bb**aa*ab****a*aaaaaa***a*aaaa**bbabb*b*b**aaaaaaaaa*a********ba*bbb***a*ba*bb*bb**a*b*bb" ) == false);
}
